package com.cashmanager.client.view;

import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.CheckboxItem;
import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
public class NewAnalysisPage extends VLayout {
	ReportWindow rw;
	IButton save;
	public IButton getSave() {
		return save;
	}
	public void setSave(IButton save) {
		this.save = save;
	}
	public IButton getClr() {
		return clr;
	}
	public void setClr(IButton clr) {
		this.clr = clr;
	}
	public IButton getRun() {
		return run;
	}
	public void setRun(IButton run) {
		this.run = run;
	}
	IButton clr;
	IButton run;
	public NewAnalysisPage(){

		VLayout vl = this;
		vl.setHeight100();
		vl.setWidth100();
		vl.setAlign(Alignment.CENTER);
		vl.setPadding(1);
		HLayout h0 =  new HLayout();
		h0.setAlign(Alignment.CENTER);
		
		HLayout h1 =  new HLayout();
		h1.setAlign(Alignment.CENTER);
		HLayout h2 =  new HLayout();
		h2.setAlign(Alignment.CENTER);

		HLayout h3 =  new HLayout();
		h3.setAlign(Alignment.CENTER);
		
		DynamicForm base = new DynamicForm();
		base.setGroupTitle("基本信息");  
	    base.setIsGroup(true);  
	    base.setHeight(100);  		    
	    base.setWidth("80%");  
	    base.setNumCols(6);
	    base.setPadding(5);
	    TextItem name = 
	    new TextItem("统计分析名字");
	    name.setValue("2005到2011年所有报表");
		TextItem author = new TextItem("创建者");
		author.setValue("测试用户");

		TextItem date = new TextItem("创建日期");
		date.setValue("2012-06-01");
		
		base.setFields(name, author, date);
		
		DynamicForm form = new DynamicForm();
		form.setGroupTitle("报表条件选择");  
	    form.setIsGroup(true);  
	    form.setHeight(100);  		    
	    form.setWidth("80%");  
	    form.setNumCols(6);
	    form.setPadding(5);
	    
        SelectItem 	location = new SelectItem("所在地区");
        location.setDefaultValue("所有地区");
        SelectItem 	bank = new SelectItem("所在银行");
        bank.setDefaultValue("所有银行");
        SelectItem 	wangdian = new SelectItem("所在网点");
        wangdian.setDefaultValue("所有网点");
        
        SelectItem 	type = new SelectItem("报表类型");
        type.setDefaultValue("月度报表");
        
        SelectItem 	fre = new SelectItem("周期跨度");
        fre.setDefaultValue("7");
        
        SelectItem 	enddate = new SelectItem("最后日期");
        enddate.setDefaultValue("2011-12-31");
        
        form.setFields(location,bank,wangdian, type, fre, enddate);
	    
        DynamicForm form1 = new DynamicForm();
		form1.setGroupTitle("报表类型选择");  
	    form1.setIsGroup(true);  
	    form1.setWidth("80%");  
	    form1.setHeight(100);  
	    form1.setNumCols(6);

	    form1.setPadding(5);
	    
	    
	    CheckboxItem total = new CheckboxItem("总流通量图表");
	    total.setValue("Y");

	    CheckboxItem fal = new CheckboxItem("假币统计图表");
	    fal.setValue("Y");
	    CheckboxItem sus = new CheckboxItem("可疑币统计图表");
	    sus.setValue("Y");
	    CheckboxItem circle = new CheckboxItem("流通面值统计图表");
	    circle.setValue("Y");
	    CheckboxItem ver = new CheckboxItem("流通版别统计图表");
	    ver.setValue("Y");
	    form1.setFields(total, fal, sus, circle, ver);
	    
	    DynamicForm form2 = new DynamicForm();
		form2.setGroupTitle("报表样式选择");  
	    form2.setIsGroup(true);  
	    form2.setWidth("80%");  
	    form2.setHeight(100);  
	    form2.setNumCols(6);
	    form2.setPadding(5);
	    CheckboxItem excel = new CheckboxItem("EXCEL报表");
	    excel.setValue("Y");
	    CheckboxItem pdf = new CheckboxItem("PDF报表");
	    pdf.setValue("Y");
	    form2.setFields(excel, pdf);
	    h0.addMember(base);
		h1.addMember(form);
		h2.addMember(form1);
		h3.addMember(form2);
		
		
	    vl.setMembersMargin(5);
				
		vl.addMember(h0);
        vl.addMember(h1);
        vl.addMember(h2);
        vl.addMember(h3);
        
        HLayout buttonLayout = new HLayout();
        buttonLayout.setAlign(Alignment.RIGHT);
         save = new IButton("保存");
        save.setWidth(100);
         clr = new IButton("清空");
        clr.setWidth(100);
         run = new IButton("执行");
        run.setWidth(100);
        run.addClickHandler(new ClickHandler(){

			public void onClick(ClickEvent event) {
			if (rw == null){
				rw = new ReportWindow();
			}
			rw.show();
				
			}
        	
        });
        Label e = new Label(" ");
        e.setWidth("10%");
        buttonLayout.addMember(save);
        
        buttonLayout.addMember(clr);
        
        buttonLayout.addMember(run);
        
        vl.addMember(buttonLayout);

	}
	
	
}
